package com.atguigu.tingshu.order.service.impl;

import com.atguigu.tingshu.model.order.LocalMsg;
import com.atguigu.tingshu.order.mapper.LocalMsgMapper;
import com.atguigu.tingshu.order.service.MqOpsService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class MqOpsServiceImpl implements MqOpsService {

    @Autowired
    private LocalMsgMapper localMsgMapper;
    @Override
    public int updateLocalMsg(String orderNo) {
        LocalMsg localMsg = localMsgMapper.selectOne(new LambdaQueryWrapper<LocalMsg>().eq(LocalMsg::getMsgContent, orderNo));
        if (localMsg != null){
            localMsg.setStatus(1);
          localMsgMapper.updateById(localMsg);
           return 1;
        }

        return 0;
    }
}
